package com.changli01.use;

import org.junit.Test;

import java.util.*;

public class CollectionMapTest {

    @Test
    public void test() {
        ArrayList<Integer> list = new ArrayList <Integer>();
        list.add(95);
        list.add(100);
        list.add(92);
        list.add(85);
        list.add(93);
//        list.add("111"); //报错
        for(Integer i : list)
            System.out.println(i);


    }
    @Test
    public void test2() {
        HashMap<String,Integer> hs = new HashMap<>();
        hs.put("sail",19);
        hs.put("kals", 20);
        System.out.println(hs);

        Set<HashMap.Entry<String, Integer>> set = hs.entrySet();
        Iterator<HashMap.Entry<String,Integer>> it = set.iterator();
        while(it.hasNext()) {
            HashMap.Entry<String,Integer> entry = it.next();
            System.out.println(entry.getKey()+"->>"+entry.getValue());
        }

    }
}
